clear all;

fig=figure('color', [1 1 1 ], 'Position',[200 20 800 760]);
t=[-4,-2,0,2,4,6];
gap=0.1;

ah1 = axes('Parent',fig,'Units','normalized','Position',[0.15 0.6 0.315 0.332]);
plot(1e10,1e10,'-','Color','b','linewidth',2);
hold on
plot(1e10,1e10,'--','Color','k','linewidth',2);
coefficient_mdl=[-1.0562141	-0.74995100	0	19.5729554000000	30.0788142000000	35.8146004000000];
coefficient_data=[-.04279301  -.01265984           0    .1855583   .30007944   .34084646].*100;
lower_data=[-.24483186  -.20373138           0   .00570113   .10015712   .11543954].*100;
upper_data=[.15924585   .17841171           0   .36541546   .51000175   .56625339].*100;
DID_plots(t,gap,coefficient_data,lower_data,upper_data,1,'--','k');
DID_plots(t,gap,coefficient_mdl,[],[],0,'-','b');

title('A. $\ln$(Employment)', 'FontSize',15,'Interpreter','Latex');
ylabel('$\ln$(employment) (\%)', 'FontSize',12,'Interpreter','Latex');
xticks(-4:2:6)
xlim([-0.5+min(t),0.5+max(t)]);
ylim([-35,75]) 
yticks(-30:30:60)
text(0.8, -14, 'branch', 'FontSize',10,'Interpreter','Latex');
text(0.8, -20.5, 'opening', 'FontSize',10,'Interpreter','Latex');
legend('model','data','interpreter','latex','location','northwest')
xlh=xlabel('years relative to branch opening','FontSize',12,'Interpreter','Latex','position',[1,-54]);
set(gca,'FontSize',12);

ah2 = axes('Parent',fig,'Units','normalized','Position',[0.6 0.6 0.315 0.332]);
coefficient_mdl=[0.19498200	0.14895710	0	3.1449470	3.9865095	3.7482538];
coefficient_data=[-.00643903  -.00748244           0    .0341609   .03938285   .03816038].*100;
lower_data=[-.03004027  -.02850054           0    .0166067   .01788227   .01462055].*100;
upper_data=[.01716221   .01353565           0   .05171511   .06088343   .06170021].*100;
DID_plots(t,gap,coefficient_data,lower_data,upper_data,1,'--','k');
DID_plots(t,gap,coefficient_mdl,[],[],0,'-','b');

title('B. Fraction of HH with bank loans', 'FontSize',15,'Interpreter','Latex');
ylabel('fraction of HH with bank loans (\%)', 'FontSize',12,'Interpreter','Latex');
xticks(-4:2:6)
xlim([-0.5+min(t),0.5+max(t)]);
ylim([-4.3,9.2]) 
yticks(-4:4:8)
text(0.8, -1.7, 'branch', 'FontSize',10,'Interpreter','Latex');
text(0.8, -2.45, 'opening', 'FontSize',10,'Interpreter','Latex');
xlh=xlabel('years relative to branch opening','FontSize',12,'Interpreter','Latex','position',[1,-6.6]);
set(gca,'FontSize',12);

ah3 = axes('Parent',fig,'Units','normalized','Position',[0.15 0.12 0.315 0.332]);
coefficient_mdl=[-0.68949280	-0.59557090	0	24.1210569000000	36.8782337000000	44.2288941000000];
coefficient_data=[-.07109672  -.00926834           0   .17421128    .2936537   .32364272].*100;
lower_data=[-.2758348  -.18204646           0   -.0008369    .1091933   .12402982].*100;
upper_data=[.13364136   .16350978           0   .34925946   .47811409   .52325563].*100;
DID_plots(t,gap,coefficient_data,lower_data,upper_data,1,'--','k');
DID_plots(t,gap,coefficient_mdl,[],[],0,'-','b');

title('C. $\ln$(Income per capita)', 'FontSize',15,'Interpreter','Latex');
ylabel('$\ln$(income per capita) (\%)', 'FontSize',12,'Interpreter','Latex');
xticks(-4:2:6)
xlim([-0.5+min(t),0.5+max(t)]);
ylim([-35,75]) 
yticks(-30:30:60)
text(0.8, -14, 'branch', 'FontSize',10,'Interpreter','Latex');
text(0.8, -20.5, 'opening', 'FontSize',10,'Interpreter','Latex');
xlh=xlabel('years relative to branch opening','FontSize',12,'Interpreter','Latex','position',[1,-54]);
set(gca,'FontSize',12);


ah4 = axes('Parent',fig,'Units','normalized','Position',[0.6 0.12 0.315 0.332]);
coefficient_mdl=[0.024513700	0.086131900	0	1.8045351	2.6925509	3.6449119];
coefficient_data=[-.01160967  -.00056622           0   .02259612   .03498602    .0396211].*100;
lower_data=[-.04261279  -.02986428           0  -.00280905   .00401491   .00979121].*100;
upper_data=[.01939346   .02873185           0    .0480013   .06595714   .06945098].*100;
DID_plots(t,gap,coefficient_data,lower_data,upper_data,1,'--','k');
DID_plots(t,gap,coefficient_mdl,[],[],0,'-','b');

title('D. Fraction of entrepreneurs', 'FontSize',15,'Interpreter','Latex');
ylabel('fraction of entrepreneurs (\%)', 'FontSize',12,'Interpreter','Latex');
xticks(-4:2:6)
xlim([-0.5+min(t),0.5+max(t)]);
ylim([-4.3,9.2]) 
yticks(-4:4:8)
text(0.8, -1.7, 'branch', 'FontSize',10,'Interpreter','Latex');
text(0.8, -2.45, 'opening', 'FontSize',10,'Interpreter','Latex');
xlh=xlabel('years relative to branch opening','FontSize',12,'Interpreter','Latex','position',[1,-6.6]);
set(gca,'FontSize',12);




annotation('textbox', [0.5985, 0.09, 0, 0], 'string', '$\widehat{\alpha}_{-3}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.656  0.09, 0, 0], 'string', '$\widehat{\alpha}_{-2}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.713  0.09, 0, 0], 'string', '$\widehat{\alpha}_{-1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.771  0.09, 0, 0], 'string', '$\widehat{\alpha}_{0}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.828  0.09, 0, 0], 'string', '$\widehat{\alpha}_{1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.885  0.09, 0, 0], 'string', '$\widehat{\alpha}_{2}$','Interpreter','Latex','FontSize',12)

annotation('textbox', [0.5985, 0.57, 0, 0], 'string', '$\widehat{\alpha}_{-3}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.656  0.57, 0, 0], 'string', '$\widehat{\alpha}_{-2}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.713  0.57, 0, 0], 'string', '$\widehat{\alpha}_{-1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.771  0.57, 0, 0], 'string', '$\widehat{\alpha}_{0}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.828  0.57, 0, 0], 'string', '$\widehat{\alpha}_{1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.885  0.57, 0, 0], 'string', '$\widehat{\alpha}_{2}$','Interpreter','Latex','FontSize',12)

annotation('textbox', [0.1485, 0.57, 0, 0], 'string', '$\widehat{\alpha}_{-3}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.206  0.57, 0, 0], 'string', '$\widehat{\alpha}_{-2}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.263  0.57, 0, 0], 'string', '$\widehat{\alpha}_{-1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.321  0.57, 0, 0], 'string', '$\widehat{\alpha}_{0}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.378  0.57, 0, 0], 'string', '$\widehat{\alpha}_{1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.435  0.57, 0, 0], 'string', '$\widehat{\alpha}_{2}$','Interpreter','Latex','FontSize',12)

annotation('textbox', [0.1485, 0.09, 0, 0], 'string', '$\widehat{\alpha}_{-3}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.206  0.09, 0, 0], 'string', '$\widehat{\alpha}_{-2}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.263  0.09, 0, 0], 'string', '$\widehat{\alpha}_{-1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.321  0.09, 0, 0], 'string', '$\widehat{\alpha}_{0}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.378  0.09, 0, 0], 'string', '$\widehat{\alpha}_{1}$','Interpreter','Latex','FontSize',12)
annotation('textbox', [0.435  0.09, 0, 0], 'string', '$\widehat{\alpha}_{2}$','Interpreter','Latex','FontSize',12)
